package com.vader.BIO;

import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

/**
 * @author Vader
 * @date 2022/5/6
 **/
public class BioClient {

    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1", 6667);
        OutputStream outputStream = socket.getOutputStream();

        while (true){
            Scanner scanner = new Scanner(System.in);
            String next = scanner.next();
            if (next.equalsIgnoreCase("quit")){
                break;
            }

            socket.getOutputStream().write(next.getBytes(StandardCharsets.UTF_8));
            System.out.println("----input quit to finsh----");
        }
        outputStream.close();
        socket.close();
    }
}
